CONFIG_MODULE_SIG = n
KERNEL_DIR := /lib/modules/$(shell uname -r)/build
PROJECT_DIR := $(shell pwd)

MODULE_TEST_BIO := test-bio
MODULE_TEST_REQ := test-req

OBJ_FILES_TEST_BIO = test_kernel_bio.o
OBJ_FILES_TEST_REQ = test_kernel_req.o

ccflags-y = $(KERNEL_CFLAGS)

obj-m := $(MODULE_TEST_BIO).o $(MODULE_TEST_REQ).o

$(MODULE_TEST_BIO)-objs := $(OBJ_FILES_TEST_BIO)
$(MODULE_TEST_REQ)-objs := $(OBJ_FILES_TEST_REQ)

all:
	$(MAKE) -C $(KERNEL_DIR) M=$(PROJECT_DIR) modules
	insmod $(MODULE_TEST_REQ).ko

clean:
	rmmod $(MODULE_TEST_REQ).ko
	$(MAKE) -C $(KERNEL_DIR) M=$(PROJECT_DIR) clean
	rm -rf *.ko *.mod.* *.o *.symvers *.order
